function undirected = undirect(directed)

% ----------------------------------------------
% This function is used to undirect an adjacency
% matrix, that is, OR the upper and lower 
% triangles.
%
% USAGE:
% undirected_matrix = undirect(directed_matrix)
% ----------------------------------------------

limit = min(size(directed));

for i = 1:limit
    for j = 1:limit
        if (directed(i,j))
            directed(j,i) = 1;
        end
    end
end

undirected = directed;

% DONE